﻿@{
    Bundle("jquery_cookie");
    Layout = "../Shared/_Default.cshtml";
    ViewBag.PageTitle = Model != null 
        ? T(Res.Name("Edit"), JDM.Int32(Model.EntityID)) 
        : T(Res.Name("Create"));
}

@section Breadcrumb
{
    <a href="@Url.Action(Loc.Act("Index").Ctrl("SalesRule"))">@T(Res.In("WebAdmin").Of("Navigation").Of("Commerce").Name("SalesRule"))</a> &gt;
}
<script type="text/javascript">
    jQuery(document).ready(function () {
        jQuery('@ID("#tabs")').tabs({
            create: function () {
                jQuery(this).tabs('option', 'active', jQuery.cookie(jQuery(this).prop('id')));
            },
            activate: function (event, ui) {
                jQuery.cookie(jQuery(this).prop('id'), ui.newTab.index());
            }
        });
    });
</script>
<section class="box">
    <header>
        @if(Model != null)
        {
            <ul class="bar toolbar">
                <li><a class="button confirm" href="@Url.Action(Loc.Act("Delete").Ctrl("SalesRule").Set(new
                {
                    id = JDM.Int32(Model.EntityID)
                }))">@T(Res.In("Common").Of("Act").Name("Delete"))</a></li>
            </ul>
        }
        <h3>@ViewBag.PageTitle</h3>
    </header>
    <section>
        <div id="@ID("tabs")">
            <ul>
                <li><a href="@ID("#tab_1")">*</a></li>
                @if(Model != null)
                {
                    <li><a href="@ID("#tab_2")">@T(Res.Name("Roles"))</a></li>
                }
            </ul>
            <div id="@ID("tab_1")">
                @RenderBody()
            </div>
            @if(Model != null)
            {
                <div id="@ID("tab_2")">
                @{
                    Html.RenderPartial("_Roles");
                }
                </div>
            }
        </div>
    </section>
    @if(Model != null)
    {
        <header>
            <h3>@T(Res.Name("History"))</h3>
        </header>
        <section>
        @{
            Html.RenderPartial("_History");
        }
        </section>
    }
</section>